package com.gxa.p2p.util;

import com.gxa.p2p.config.JavaEmailSender;

import javax.servlet.http.HttpServletRequest;

public class SendMailUtil {
    Integer code=null;

    public Integer getCode() {
        return code;
    }

    //封装的发送邮件方法
    public String mailSucc(HttpServletRequest request) throws Exception{
        String toEMAIL = request.getParameter("email");         //对方邮箱
        int mobile_code = (int)((Math.random() * 9 + 1) * 100000);// 有一定的规范,不可随意生成随机数
        code=mobile_code;
        String content = "您的验证码是：" + mobile_code + "。请不要把验证码泄露给其他人。";
        String CONTENT =toEMAIL+"验证码发送成功";        //内容1
        JavaEmailSender.sendEmail(toEMAIL, content, CONTENT);
        return "/mailSucc";


    }
}
